package com.java.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author: wjr
 * @Description:
 * @Date Created in  2020-09-07 1:04
 * @Modified By:
 */
public class ResponseUtils {
    /**
      * @Description 向页面发送提示信息的方法
      * @param resp 响应对象
      * @param msg 提示信息
      * @param page  确认后跳转的页面
      * @Return void
      * @Author wjr
      * @Date Created in 2020/9/7 1:06
      */
    public void ResponseMsg(HttpServletResponse resp,String msg, String page){
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = null;
        try {
            writer = resp.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        writer.print("<script>alert('" +msg+
                "');location.href='" +page+
                "'</script>");
    }
}
